{# ----------------------------------------------------------------------------
 # SymForce - Copyright 2022, Skydio, Inc.
 # This source code is under the Apache 2.0 license found in the LICENSE file.
 # ---------------------------------------------------------------------------- #}


  // Generate a random element in Unit3
  template <typename Generator>
  static Unit3 Random(Generator& gen, Scalar epsilon = kDefaultEpsilon<Scalar>) {
    std::uniform_real_distribution<Scalar> dist(0.0, 1.0);
    const auto u1 = dist(gen);
    const auto u2 = dist(gen);
    return RandomFromUniformSamples(u1, u2, epsilon);
  }

  /**
   * Return a :class:`Unit3` that points along the direction of vector ``a``
   *
   * ``a`` will be normalized.
   */
  const static sym::Unit3<Scalar> FromVector(const Vector3& a) {
    return sym::Unit3<Scalar>(a);
  }

  /**
   * Return a :class:`Unit3` that points along the direction of vector ``a``
   *
   * ``a`` is expected to be a unit vector.
   */
  const static sym::Unit3<Scalar> FromUnitVector(const Vector3& a) {
    return sym::Unit3<Scalar>(a, false);
  }
